<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
 
    <script>
        var m = 7;
        for (var i = 0; i < m; i++) {
            var t = 0; //t是用来存放距离边界需要多少空格
            if (i >= m / 2) {// >是m为奇数的情况下的判断，=是m为偶数的情况下的判断，这里将过半的那些i值转换为与它对称的i值
                t = m - 1 - i;
            } else {
                t = i;
            }
            for (var j = 1; j <= m; j++) {
                if (j >= (m + 1) / 2 - t && j <= (m + 1) / 2 + t) {
                    document.write("*");
                } else {
                    document.write("<span style='white-space:pre;'>" + " " + "</span>");
                }
            }
            document.write("<br>");
        }
    </script>
</head>
<body>
 
</body>
</html>